home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Browsers, Managers & Extensions / Firefox Backup Extension 6.0.3 / chrome / febe.jar / content / febeHelp.js < prev    next >
Text File  |  2008-08-17  |  11KB  |  284 lines

  1. // author: Chuck Baker
  2. // contact: febe@customsoftwareconsult.com
  3. // Version 6.0
  4.  
  5. function febeLoadHelp(){
  6.     var index = window.arguments[0];
  7.     var field = window.arguments[1];
  8.     const HTMLNS = "http://www.w3.org/1999/xhtml";
  9.  
  10.     document.getElementById("field").value = field;
  11.     var fh = document.getElementById('febe-help');
  12.     var helpTxt = fh.getString("febe.help_"+index+".text1");
  13.     
  14.     // XUL pallette
  15.     var desc = document.createElement('description');
  16.     desc.setAttribute('flex', "1");
  17.     var separator = document.createElement('separator');
  18.     separator.setAttribute('class', "thin");
  19.     var vbox = document.createElement('vbox');
  20.     var hbox = document.createElement('hbox');
  21.     var grid = document.createElement('grid');
  22.     var columns = document.createElement('columns');
  23.     var column = document.createElement('column');
  24.     var rows = document.createElement('rows');
  25.     var row = document.createElement('row');
  26.     var spacer = document.createElement('spacer');
  27.     spacer.setAttribute('flex', "1");
  28.     var image = document.createElement('image');
  29.     var label = document.createElement('label');
  30.     var text = document.createElement('text');
  31.     // HTML namespace elements
  32.     var htmlul = document.createElementNS(HTMLNS, "html:ul");
  33.     var htmlli = document.createElementNS(HTMLNS, "html:li");
  34.  
  35.     var helpTxtbox = document.getElementById('helptextbox');
  36.     //helpTxtbox.appendChild(desc);
  37.  
  38.     switch(index){
  39.         case "01": case "10":    // Two lines of text
  40.             helpTxt = fh.getString("febe.help_"+index+".text1");
  41.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  42.  
  43.             helpTxtbox.appendChild(separator);
  44.         
  45.             helpTxt = fh.getString("febe.help_"+index+".text2");
  46.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  47.             break;
  48.         case "03": case "04": case "28":    // Three lines of text
  49.             helpTxt = fh.getString("febe.help_"+index+".text1");
  50.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  51.  
  52.             helpTxtbox.appendChild(separator);
  53.         
  54.             helpTxt = fh.getString("febe.help_"+index+".text2");
  55.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  56.             
  57.             helpTxt = fh.getString("febe.help_"+index+".text3");
  58.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  59.             break;
  60.         case "05":    case "99":    // Restore profile
  61.             helpTxt = fh.getString("febe.help_05.text1").replace("%LINK%","");
  62.             var desc = desc.cloneNode(false);
  63.             desc.appendChild(document.createTextNode(helpTxt));
  64.             var text = text.cloneNode(false);
  65.             text.setAttribute('value', "http://kb.mozillazine.org/Profile_Manager");
  66.             text.setAttribute('class', "link");
  67.             text.setAttribute('onclick', "febeOpenLink('http://kb.mozillazine.org/Profile_Manager');");
  68.             desc.appendChild(text);
  69.             helpTxtbox.appendChild(desc);
  70.             if(index == "99"){    // Restore profile error message
  71.                 helpTxtbox.appendChild(separator);
  72.                 var desc = desc.cloneNode(false);
  73.                 helpTxt = fh.getString("febe.help_99.text1");
  74.                 var text = text.cloneNode(false);
  75.                 text.setAttribute('value', helpTxt);
  76.                 text.setAttribute('class', "font12");
  77.                 desc.appendChild(text);
  78.                 
  79.                 helpTxt = fh.getString("febe.help_99.text2")+" "+fh.getString("febe.help_99.text3")+" ";
  80.                 desc.appendChild(document.createTextNode(helpTxt));
  81.                 
  82.                 var linkTxt = fh.getString("febe.help_99.text4");
  83.                 var text = text.cloneNode(false);
  84.                 text.setAttribute('class', "link");
  85.                 text.setAttribute('value', linkTxt);
  86.                 text.setAttribute('onclick', "febeOpenLink('http://www.customsoftwareconsult.com/phpBB2/viewtopic.php?t=593');");
  87.                 desc.appendChild(text);
  88.                 
  89.                 helpTxt = " "+fh.getString("febe.help_99.text5");
  90.                 var text = text.cloneNode(false);
  91.                 text.setAttribute('value', helpTxt);
  92.                 text.removeAttribute('class');
  93.                 text.removeAttribute('onclick');
  94.                 desc.appendChild(text);                
  95.                 helpTxtbox.appendChild(desc);                
  96.             }//if
  97.             
  98.             break;
  99.         case "07":
  100.             var htmlul = htmlul.cloneNode(false);
  101.             var htmlli = htmlli.cloneNode(false);
  102.             var image = image.cloneNode(false);
  103.             image.setAttribute('src', "chrome://febe/skin/play.png");
  104.             image.setAttribute('style', "cursor: pointer");
  105.             var tooltip = fh.getString("febe.help_"+index+".text7");
  106.             image.setAttribute('tooltiptext', tooltip);    
  107.             
  108.             helpTxt = fh.getString("febe.help_"+index+".text1");
  109.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  110.  
  111.             helpTxt = fh.getString("febe.help_"+index+".text2")+"  ";
  112.             var htmlli = htmlli.cloneNode(false);
  113.             htmlli.appendChild(document.createTextNode(helpTxt));
  114.             var image = image.cloneNode(true);
  115.             image.setAttribute('onclick', "febePlaySoundHelp('success');");
  116.             htmlli.appendChild(image);
  117.             htmlul.appendChild(htmlli);
  118.             
  119.             helpTxt = fh.getString("febe.help_"+index+".text3")+"  ";
  120.             var htmlli = htmlli.cloneNode(false);
  121.             htmlli.appendChild(document.createTextNode(helpTxt));
  122.             var image = image.cloneNode(true);
  123.             image.setAttribute('onclick', "febePlaySoundHelp('failure');");
  124.             htmlli.appendChild(image);
  125.             htmlul.appendChild(htmlli);
  126.             
  127.             helpTxt = fh.getString("febe.help_"+index+".text4")+"  ";
  128.             var htmlli = htmlli.cloneNode(false);
  129.             htmlli.appendChild(document.createTextNode(helpTxt));
  130.             var image = image.cloneNode(true);
  131.             image.setAttribute('onclick', "febePlaySoundHelp('warning');");            
  132.             htmlli.appendChild(image);
  133.             htmlul.appendChild(htmlli);
  134.  
  135.             helpTxt = fh.getString("febe.help_"+index+".text5")+"  ";
  136.             var htmlli = htmlli.cloneNode(false);
  137.             htmlli.appendChild(document.createTextNode(helpTxt));
  138.             var image = image.cloneNode(true);
  139.             image.setAttribute('onclick', "febePlaySoundHelp('alert');");
  140.             htmlli.appendChild(image);
  141.             htmlul.appendChild(htmlli);
  142.             
  143.             helpTxt = fh.getString("febe.help_"+index+".text6")+"  ";
  144.             var htmlli = htmlli.cloneNode(false);
  145.             htmlli.appendChild(document.createTextNode(helpTxt));
  146.             var image = image.cloneNode(true);
  147.             image.setAttribute('onclick', "febePlaySoundHelp('help');");
  148.             htmlli.appendChild(image);
  149.             htmlul.appendChild(htmlli);
  150.             
  151.             vbox.appendChild(htmlul);
  152.             helpTxtbox.appendChild(vbox);
  153.             break;
  154.         case "09":
  155.             var hbox = hbox.cloneNode(false);
  156.             var desc = desc.cloneNode(false);
  157.                 helpTxt = fh.getString("febe.help_"+index+".text1")
  158.                 desc.appendChild(document.createTextNode(helpTxt));
  159.             hbox.appendChild(desc);
  160.             helpTxtbox.appendChild(hbox);
  161.             var separator = separator.cloneNode(true);
  162.             helpTxtbox.appendChild(separator);
  163.  
  164.             //<grid>
  165.             var grid = grid.cloneNode(false);
  166.                 var columns = columns.cloneNode(false);
  167.                     var column = column.cloneNode(false);
  168.                         columns.appendChild(column);
  169.                     var column = column.cloneNode(false);
  170.                         column.setAttribute('flex', "1");
  171.                         columns.appendChild(column);
  172.                 grid.appendChild(columns);
  173.                 var rows = rows.cloneNode(false);
  174.                     var row = row.cloneNode(false);
  175.                         var image = image.cloneNode(false);
  176.                             image.setAttribute('style', "max-width: 16px; max-height: 16px");
  177.                             image.setAttribute('src', "chrome://febe/skin/febeYesBU.png");
  178.                         var desc = desc.cloneNode(false);
  179.                             helpTxt = fh.getString("febe.help_"+index+".text2")
  180.                             desc.appendChild(document.createTextNode(helpTxt));
  181.                         row.appendChild(image);    
  182.                         row.appendChild(desc);
  183.                     rows.appendChild(row);
  184.                         var row = row.cloneNode(false);
  185.                         var image = image.cloneNode(false);
  186.                             image.setAttribute('style', "max-width: 16px; max-height: 16px");
  187.                             image.setAttribute('src', "chrome://febe/skin/febeNoBU.png");
  188.                         var desc = desc.cloneNode(false);
  189.                             helpTxt = fh.getString("febe.help_"+index+".text3")
  190.                             desc.appendChild(document.createTextNode(helpTxt));
  191.                         row.appendChild(image);    
  192.                         row.appendChild(desc);
  193.                     rows.appendChild(row);    
  194.                         var row = row.cloneNode(false);
  195.                         var image = image.cloneNode(false);
  196.                             image.setAttribute('style', "max-width: 16px; max-height: 16px");
  197.                             image.setAttribute('src', "chrome://febe/skin/febeWarning.gif");
  198.                         var desc = desc.cloneNode(false);
  199.                             helpTxt = fh.getString("febe.help_"+index+".text4")
  200.                             desc.appendChild(document.createTextNode(helpTxt));
  201.                         row.appendChild(image);    
  202.                         row.appendChild(desc);    
  203.  
  204.                     rows.appendChild(row);
  205.                 
  206.             grid.appendChild(rows);
  207.             helpTxtbox.appendChild(grid);
  208.             var separator = separator.cloneNode(true);
  209.             helpTxtbox.appendChild(separator);
  210.             var desc = desc.cloneNode(false);
  211.                 helpTxt = fh.getString("febe.help_"+index+".text5")
  212.                 desc.appendChild(document.createTextNode(helpTxt));
  213.             helpTxtbox.appendChild(desc);
  214.             break;
  215.         case "11":
  216.             helpTxt = fh.getString("febe.help_"+index+".text1");
  217.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  218.             helpTxtbox.appendChild(spacer);
  219.             
  220.             var desc = desc.cloneNode(false);
  221.             var hbox = hbox.cloneNode(false);
  222.             var label = label.cloneNode(false);
  223.                 helpTxt = fh.getString("febe.help_"+index+".text2");
  224.                 label.setAttribute('value', helpTxt);
  225.             var image = image.cloneNode(false);
  226.                 image.setAttribute('class', "helpButton");
  227.             hbox.appendChild(label);
  228.             hbox.appendChild(separator);
  229.             hbox.appendChild(image);
  230.             desc.appendChild(hbox);
  231.             helpTxtbox.appendChild(desc);
  232.             helpTxt = fh.getString("febe.help_"+index+".text3");
  233.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  234.             break;
  235.         case "21":
  236.             for(var i=1; i<11; i++){ 
  237.                 helpTxt = fh.getString("febe.help_"+index+".text"+i);
  238.                 febeAddTxtHelpLine(helpTxtbox,helpTxt);
  239.             }//for
  240.             break;
  241.         case "29":
  242.             for(var i=1; i<4; i++){ 
  243.                 helpTxt = fh.getString("febe.help_"+index+".text"+i);
  244.                 febeAddTxtHelpLine(helpTxtbox,helpTxt);
  245.             }//for
  246.             helpTxt = fh.getString("febe.help_"+index+".text4");
  247.             var desc = desc.cloneNode(false);
  248.             desc.setAttribute('style', "font-weight: bold;");
  249.             desc.appendChild(document.createTextNode(helpTxt));
  250.             helpTxtbox.appendChild(desc);
  251.             var separator = separator.cloneNode(true);
  252.             helpTxtbox.appendChild(separator);
  253.             
  254.             helpTxt = fh.getString("febe.help_"+index+".text5")+" ";
  255.             var desc = document.createElement('description');
  256.             desc.setAttribute('flex', "1");
  257.             desc.appendChild(document.createTextNode(helpTxt));
  258.             var linkTxt = fh.getString("febe.help_"+index+".text6");
  259.             var text = text.cloneNode(false);
  260.             text.setAttribute('class', "link");
  261.             text.setAttribute('value', linkTxt);
  262.             text.setAttribute('onclick', "febeOpenLink('http://www.jdoqocy.com/click-3044448-10490221');");
  263.             desc.appendChild(text);
  264.             helpTxtbox.appendChild(desc);
  265.             break;
  266.  
  267.         default:
  268.             helpTxt = fh.getString("febe.help_"+index+".text1");
  269.             febeAddTxtHelpLine(helpTxtbox,helpTxt);
  270.             break;
  271.     }//switch
  272.     febePlaySound("help");
  273.     return true;
  274. }//febeLoadHelp()
  275.  
  276. function febeAddTxtHelpLine(box,txt){
  277.     var desc = document.createElement('description');
  278.     desc.setAttribute('flex', "1");
  279.     desc.appendChild(document.createTextNode(txt));
  280.     box.appendChild(desc);
  281.     var separator = document.createElement('separator');
  282.     separator.setAttribute('class', "thin");
  283.     box.appendChild(separator);
  284. }//febeAddTxtHelpLine()